package com.yili.oa.entity;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class FtAccountDetailsSearch extends SearchBase {

    private Calendar calendar = Calendar.getInstance();

    private Integer tradeType;

    private String userId;

    private List<Long> ids;

    private Long begin;

    private Long end;

    public Integer getTradeType() {
        return tradeType;
    }

    public void setTradeType(Integer tradeType) {
        this.tradeType = tradeType;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public List<Long> getIds() {
        if(StringUtils.isEmpty(userId)){
            return null;
        }
        List<Long> idList = new ArrayList<>();
        idList.add(Long.valueOf(userId));
        return idList;
    }

    public void setIds(List<Long> ids) {
        this.ids = ids;
    }

    public Long getBegin() {
        //获取今天的时间0点0分0秒的时间戳
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        this.begin = calendar.getTime().getTime()/1000;
        this.begin*=1000;
        return begin;
    }

    public void setBegin(Long begin) {
        this.begin = begin;
    }

    public Long getEnd() {
        //获取今天的时间23点59分59秒的时间戳
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        this.end = calendar.getTime().getTime()/1000+ 24*60*60L-1L;
        this.end*=1000;
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }
}
